# The join orders:
# $1: (NOT used), the file identifier
# $2: numOfOriginalTOP10DocumentResultRetainedAtTOP10Position
# $3: numOfOriginalTOP10PostingRetainedAtTOP10Position
# $4: top10DocumentResultDict
# $5: top10PostingWithDocumentResultDict
# $6: totalEvaluationCostFromPrunedIndexModel1
# $7: totalEvaluationCostFromPrunedIndexModel2
# $8: totalEvaluationCostFromFullIndexModel1
# $9: totalEvaluationCostFromFullIndexModel2
# $10: numOfOriginalTOP10PostingsRetainedInPrunedIndex
# $11: percentage identifier

#echo "Computed by Wei on 2014/07/10"
#echo "format of each data line:"
#echo "col1: % index kept"
#echo "col2: # of unpruned TOP10 document results retained@10 pruned index"
#echo "col3: # of unpruned TOP10 postings retained@10 pruned index"
#echo "col4: # of unpruned TOP10 postings retained in pruned index"
#echo "col5: total # of TOP10 document results in unpruned index(fixed)"
#echo "col6: total # of TOP10 postings in unpruned index(fixed)"
#echo "col7: query processing cost in pruned index"
#echo "col8: total query processing cost in unpruned index(fixed)"
#echo "col9: % of unpruned TOP10 document results retained@10"
#echo "col10: % of unpruned TOP10 postings retained@10"
#echo "col11: % of unpruned TOP10 postings retained in pruned index"
#echo "col12: % of query processing cost"

#echo "dataset:" $1
#echo "queryLength:" $2
#echo "date:" $3
#echo "dynamicWeight:" $4
#echo "cutoff:" $5
#echo "# of queries:" $6
#echo "note:" $7 # maybe sth like "unigramProbabilityModelFromJuan"
#echo "fixedPatch1:" $8
#echo "fixedPatch2:" $9
echo "dataset=$1 queryLength=$2 date=$3 dynamicWeight=$4 numOfQueries=$6 note=$7"
IFN="evaluate_ALL_IN_ONE_$1_cutoff$5_queryLength_$2_weight_$4$8_$3$9"
awk '{print $11,$2,$3,$10,$6,$4,$5,$8,$2/$4,$3/$5,$10/$5,$6/$8}' <(join <(awk 'BEGIN {counter=0} {if($1 == "numOfOriginalTOP10DocumentResultRetainedAtTOP10Position:") print counter++,$2;}' < "$IFN") <(awk 'BEGIN {counter=0} {if($1 == "numOfOriginalTOP10PostingRetainedAtTOP10Position:") print counter++,$2;}' < "$IFN") | join - <(awk 'BEGIN {counter=0} {if($1 == "len(top10DocumentResultDict):") print counter++,$2;}' < "$IFN") | join - <(awk 'BEGIN {counter=0} {if($1 == "len(top10PostingWithDocumentResultDict):") print counter++,$2;}' < "$IFN") | join - <(awk 'BEGIN {counter=0} {if($1 == "totalEvaluationCostFromPrunedIndexModel1:") print counter++,$2;}' < "$IFN") | join - <(awk 'BEGIN {counter=0} {if($1 == "totalEvaluationCostFromPrunedIndexModel2:") print counter++,$2;}' < "$IFN") | join - <(awk 'BEGIN {counter=0} {if($1 == "totalEvaluationCostFromFullIndexModel1:") print counter++,$2;}' < "$IFN") | join - <(awk 'BEGIN {counter=0} {if($1 == "totalEvaluationCostFromFullIndexModel2:") print counter++,$2;}' < "$IFN") | join - <(awk 'BEGIN {counter=0} {if($1 == "numOfOriginalTOP10PostingsRetainedInPrunedIndex:") print counter++,$2;}' < "$IFN") | join - tempPercentage)
echo
